# JFLAGS=-g
JFLAGS=-sourcepath parser:generated:absyn:rtl:mips -d build 


all: 
	cd generated; javacc ../parser/parser.jj
	mkdir -p build 
	javac ${JFLAGS} generated/UcParser.java
clean:
	rm build/*.class
	mkdir  -p .waste
	mv generated/*.java .waste


# To compile: make
# To run: java -ea -cp build UcParse test.c
# To remove generated files: make clean




#                            EXPLANATIONS
#
# JFLAGS=-sourcepath parser:generated:absyn:rtl:mips -d build 
# 
# Flag -sourcepath tells the compiler to look in the listed
# directories for source files
# 
# Flag -d tells the compiler to put .class files in directory called
# "build".
# 
#
# all: 
# 
# This defines the default goal for make
# 
# 	cd generated; javacc ../parser/parser.jj
# 
# This line runs javacc and puts generated Java files in directory
# "generated"
# 
# 	mkdir -p build 
# 
# This line creates a directory "build", if not already present.
# 
# 	javac ${JFLAGS} generated/UcParse.java
# 
# Here we run the compiler with the flags defined above on the Java
# file generated by the parser generator. Other Java files will also
# be compiled, if they are referred to by UcParse.java.
# 
# 
# clean:
# 
# This defines the goal "clean" for make. 
# 
# 	rm build/*.class
# 
# Simply remove all .class files (created by the Java compiler).
# 
# 	mkdir -p .waste 
# 
# Create a hidden directory ".waste", if not already present.
# 
# 	mv generated/*.java .waste
# 
# Move all Java files generated by the parser generator to this
# directory.
#
# 
# java -ea -cp build UcParse test.c
# 
# Flag -ea tells Java to report an error if an assertion does not
# hold.
#
# Flag -cp build tells Java to look for .class files in the directory
# build.
#
# The class UcParse defines the method main that is to be executed.
#
# test.c is the name of the C file that is input to the compiler,
